package com.classes.method;

import java.nio.ByteBuffer;

import com.classes.CMN;
import com.classes.attributes.AttributeContext;
import com.classes.field.FiledAccessFlagEnum;

/**
 * @author chuer
 * @version V1.0
 * @Description: 字段表集合
 * @date 2015年4月24日 上午10:42:30
 */
public class MethodTable {

    public static void methodInfo(ByteBuffer buffer) {
        short methodLength = buffer.getShort();
        System.out.println("方法长度：" + methodLength);

        for (int i = 0; i < methodLength; i++) {
            short accessFlag = buffer.getShort();
            short nameIndex = buffer.getShort();
            short descIndex = buffer.getShort();
            short attributesCount = buffer.getShort();


            int[] is = CMN.methodAccessFlagMap.get(accessFlag + "");
            System.out.print("方法访问标识:");
            for (int flag : is) {
                System.out.print(" " + FiledAccessFlagEnum.getFlag(flag));
            }
            System.out.println("  nameIndex=" + nameIndex + " descIndex=" + descIndex + " attributesCount=" + attributesCount);


            for (int j = 0; j < attributesCount; j++) {
                AttributeContext context = new AttributeContext(buffer);
                context.parse();
            }

        }

    }
}

